package com.example.loop.thymeleafdemo.controller;/*
@author joker
@create 2022-04-28 17:22
SpringMVCdemo01
*/

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

@Controller
public class indexController {

    /**
     * @param model 可以存放数据, 放入到request作用域
     * @return String: 表示视图
     */
    @RequestMapping("/hello")
    public String hello(Model model, HttpServletRequest request) {
        //添加数据
        //model.addAttribute("name", "梁敬益");
        request.setAttribute("name","张三");
        //指定模板视图
        return "hello";
    }
}
